Imports ToDoList.Navigation

Namespace Usecases
  Public Class EditTaskDetailsUsecase

    Public Enum EditResult
      Success
      Cancelled
    End Enum

    Private mMyNavigation As IEditTaskDetailsNavigation
    Private mResult As EditResult

    ''' <summary>
    ''' constructor
    ''' </summary>
    ''' <param name="navigation">view for this usecase</param>
    Public Sub New(ByVal navigation As IEditTaskDetailsNavigation)
      mMyNavigation = navigation
    End Sub

    ''' <summary>
    ''' Start this usecase to show the editable details of the task
    ''' </summary>
    ''' <param name="task">task to edit</param>
    ''' <param name="parentList">List to which this task belongs</param>
    Public Sub Start(ByVal task As Model.Task, ByVal parentList As Model.Todolist)
      'show edit view
      mMyNavigation.ShowTaskDetails(task)
    End Sub

    ''' <summary>
    ''' user finished editing
    ''' </summary>
    ''' <param name="task"></param>
    ''' <remarks></remarks>
    Public Sub EditingFinished(ByVal task As Model.Task)
      mResult = EditResult.Success
    End Sub

    ''' <summary>
    ''' user cancelled the editing
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub EditingCancelled()
      mResult = EditResult.Cancelled
    End Sub

    ''' <summary>
    ''' usecase result
    ''' </summary>
    ''' <value></value>
    Public ReadOnly Property Result() As EditResult
      Get
        Return mResult
      End Get
    End Property
  End Class
End Namespace

